home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / comm / mail / YAM23src.lha / Source / YAM_CO.c < prev    next >
C/C++ Source or Header  |  2001-05-14  |  60KB  |  1,430 lines

  1. /***************************************************************************
  2.  
  3.  YAM - Yet Another Mailer
  4.  Copyright (C) 1995-2000 by Marcel Beck <mbeck@yam.ch>
  5.  Copyright (C) 2000-2001 by YAM Open Source Team
  6.  
  7.  This program is free software; you can redistribute it and/or modify
  8.  it under the terms of the GNU General Public License as published by
  9.  the Free Software Foundation; either version 2 of the License, or
  10.  (at your option) any later version.
  11.  
  12.  This program is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  GNU General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU General Public License
  18.  along with this program; if not, write to the Free Software
  19.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20.  
  21.  YAM Official Support Site :  http://www.yam.ch
  22.  YAM OpenSource project    :  http://sourceforge.net/projects/yamos/
  23.  
  24.  $Id: YAM_CO.c,v 1.11.2.1 2001/05/14 19:58:53 laursen Exp $
  25.  
  26. ***************************************************************************/
  27.  
  28. #include "YAM.h"
  29.  
  30. /* local protos */
  31. LOCAL void CO_NewPrefsFile(char*);
  32. LOCAL int CO_DetectPGP(struct Config*);
  33. LOCAL void CO_CopyConfig(struct Config*, struct Config*);
  34. LOCAL APTR CO_BuildPage(struct CO_ClassData*, int);
  35. LOCAL struct CO_ClassData *CO_New(void);
  36.  
  37.  
  38. /***************************************************************************
  39.  Module: Configuration
  40. ***************************************************************************/
  41.  
  42. /// CO_NewPrefsFile
  43. //  Sets the name of the configuration file
  44. LOCAL void CO_NewPrefsFile(char *fname)
  45. {
  46.    static char wtitle[SIZE_SMALL+SIZE_PATHFILE];
  47.    strcpy(G->CO_PrefsFile, fname);
  48.    sprintf(wtitle, "%s (%s)", GetStr(MSG_MA_MConfig), fname);
  49.    set(G->CO->GUI.WI, MUIA_Window_Title, wtitle);
  50. }
  51. ///
  52.  
  53. /**** Rules ****/
  54. /// CO_NewRule
  55. //  Initializes a new rule
  56. struct Rule *CO_NewRule(void)
  57. {
  58.    struct Rule *rule;
  59.    if (rule = calloc(1,sizeof(struct Rule)))
  60.    {
  61.       strcpy(rule->Name, GetStr(MSG_NewEntry));
  62.       rule->ApplyToNew = rule->ApplyOnReq = TRUE;
  63.    }
  64.    return rule;
  65. }
  66. ///
  67. /// CO_AddRule
  68. //  Adds a new entry to the rule list
  69. void SAVEDS CO_AddRule(void)
  70. {
  71.    int i, m, s;
  72.    for (i = 0; i < MAXRU; i++)
  73.       if (!CE->RU[i])
  74.       {
  75.          CE->RU[i] = CO_NewRule();
  76.          for (s = 0; s < 4; s++) for (m = 0; m < 5; m++)
  77.          {
  78.             struct SearchGroup *sg = &(G->CO->GUI.GR_SEARCH[s]);
  79.             nnset(sg->CY_COMP[m], MUIA_Cycle_Active, 0);
  80.             if (sg->ST_MATCH[m]) nnset(sg->ST_MATCH[m], MUIA_String_Contents, "");
  81.             else nnset(sg->CY_STATUS, MUIA_Cycle_Active, 0);
  82.             if (sg->CH_CASESENS[m]) nnset(sg->CH_CASESENS[m], MUIA_Selected, FALSE);
  83.             if (sg->CH_SUBSTR[m]) nnset(sg->CH_SUBSTR[m], MUIA_Selected, FALSE);
  84.          }
  85.          DoMethod(G->CO->GUI.LV_RULES, MUIM_List_InsertSingle, CE->RU[i], MUIV_List_Insert_Bottom);
  86.          set(G->CO->GUI.LV_RULES, MUIA_List_Active, i);
  87.          break; 
  88.       }
  89. }
  90. MakeHook(CO_AddRuleHook,CO_AddRule);
  91.  
  92. ///
  93. /// CO_DelRule
  94. //  Deletes an entry from the rule list
  95. void SAVEDS CO_DelRule(void)
  96. {
  97.    int i, p;
  98.    get(G->CO->GUI.LV_RULES, MUIA_List_Active, &p);
  99.    if (p != MUIV_List_Active_Off)
  100.    {
  101.       DoMethod(G->CO->GUI.LV_RULES, MUIM_List_Remove, p);
  102.       for (i = p+1; i < MAXRU; i++) CE->RU[i-1] = CE->RU[i];
  103.       CE->RU[i-1] = 0;
  104.    }
  105. }
  106. MakeHook(CO_DelRuleHook,CO_DelRule);
  107.  
  108. ///
  109. /// CO_RuleGhost
  110. //  Enables/disables gadgets in rule form
  111. void CO_RuleGhost(struct CO_GUIData *gui, struct Rule *ru)
  112. {
  113.    BOOL isremote = FALSE, single = FALSE;
  114.  
  115.    if (ru) { isremote = ru->Remote; single = !ru->Combine; }
  116.    set(gui->ST_RNAME, MUIA_Disabled, !ru);
  117.    set(gui->CH_REMOTE, MUIA_Disabled, !ru);
  118.    set(gui->CH_APPLYNEW, MUIA_Disabled, !ru || isremote);
  119.    set(gui->CH_APPLYREQ, MUIA_Disabled, !ru || isremote);
  120.    set(gui->CH_APPLYSENT, MUIA_Disabled, !ru || isremote);
  121.    set(gui->CY_COMBINE[isremote], MUIA_Disabled, !ru);
  122.    set(gui->CH_ABOUNCE, MUIA_Disabled, !ru || isremote);
  123.    set(gui->CH_AFORWARD, MUIA_Disabled, !ru || isremote);
  124.    set(gui->CH_ARESPONSE, MUIA_Disabled, !ru || isremote);
  125.    set(gui->CH_AEXECUTE, MUIA_Disabled, !ru);
  126.    set(gui->CH_APLAY, MUIA_Disabled, !ru);
  127.    set(gui->CH_AMOVE, MUIA_Disabled, !ru || isremote);
  128.    set(gui->CH_ADELETE, MUIA_Disabled, !ru);
  129.    set(gui->CH_ASKIP, MUIA_Disabled, !ru || !isremote);
  130.    set(gui->ST_ABOUNCE, MUIA_Disabled, !ru);
  131.    set(gui->ST_AFORWARD, MUIA_Disabled, !ru);
  132.    set(gui->ST_ARESPONSE, MUIA_Disabled, !ru);
  133.    set(gui->ST_AEXECUTE, MUIA_Disabled, !ru);
  134.    set(gui->ST_APLAY, MUIA_Disabled, !ru);
  135.    set(gui->TX_MOVETO, MUIA_Disabled, !ru);
  136.    set(gui->BT_RDEL, MUIA_Disabled, !ru);
  137.    FI_SearchGhost(&(gui->GR_SEARCH[2*isremote]), !ru);
  138.    FI_SearchGhost(&(gui->GR_SEARCH[2*isremote+1]), !ru || single);
  139.  
  140. }
  141.  
  142. ///
  143. /// CO_GetRUEntry
  144. //  Fills form with data from selected list entry
  145. void SAVEDS CO_GetRUEntry(void)
  146. {
  147.    struct Rule *rule = NULL;
  148.    struct CO_GUIData *gui = &G->CO->GUI;
  149.  
  150.    DoMethod(gui->LV_RULES, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &rule);
  151.    if (rule)
  152.    {      
  153.       int m, i, k, rm = rule->Remote ? 1 : 0;
  154.       nnset(gui->ST_RNAME,    MUIA_String_Contents, rule->Name);
  155.       nnset(gui->CH_REMOTE,   MUIA_Selected, rm);
  156.       nnset(gui->CH_APPLYNEW, MUIA_Selected, rule->ApplyToNew);
  157.       nnset(gui->CH_APPLYSENT,MUIA_Selected, rule->ApplyToSent);
  158.       nnset(gui->CH_APPLYREQ, MUIA_Selected, rule->ApplyOnReq);
  159.       nnset(gui->CY_COMBINE[rm],MUIA_Cycle_Active, rule->Combine);
  160.       nnset(gui->CH_ABOUNCE,   MUIA_Selected, (rule->Actions&  1)==  1);
  161.       nnset(gui->CH_AFORWARD,  MUIA_Selected, (rule->Actions&  2)==  2);
  162.       nnset(gui->CH_ARESPONSE, MUIA_Selected, (rule->Actions&  4)==  4);
  163.       nnset(gui->CH_AEXECUTE,  MUIA_Selected, (rule->Actions&  8)==  8);
  164.       nnset(gui->CH_APLAY,     MUIA_Selected, (rule->Actions& 16)== 16);
  165.       nnset(gui->CH_AMOVE,     MUIA_Selected, (rule->Actions& 32)== 32);
  166.       nnset(gui->CH_ADELETE,   MUIA_Selected, (rule->Actions& 64)== 64);
  167.       nnset(gui->CH_ASKIP,     MUIA_Selected, (rule->Actions&128)==128);
  168.       nnset(gui->ST_ABOUNCE   ,MUIA_String_Contents, rule->BounceTo);
  169.       nnset(gui->ST_AFORWARD  ,MUIA_String_Contents, rule->ForwardTo);
  170.       nnset(gui->ST_ARESPONSE ,MUIA_String_Contents, rule->ReplyFile);
  171.       nnset(gui->ST_AEXECUTE  ,MUIA_String_Contents, rule->ExecuteCmd);
  172.       nnset(gui->ST_APLAY     ,MUIA_String_Contents, rule->PlaySound);
  173.       nnset(gui->TX_MOVETO    ,MUIA_Text_Contents, rule->MoveTo);
  174.       set(gui->GR_LRGROUP, MUIA_Group_ActivePage, rm);
  175.       for (i = 0; i < 2; i++)
  176.       {
  177.          struct SearchGroup *sg = &(gui->GR_SEARCH[i+2*rm]);
  178.          nnset(sg->CY_MODE       ,MUIA_Cycle_Active, rule->Field[i]);
  179.          nnset(sg->RA_ADRMODE    ,MUIA_Radio_Active, rule->SubField[i]);
  180.          nnset(sg->ST_FIELD      ,MUIA_String_Contents, rule->CustomField[i]);
  181.          nnset(sg->PG_SRCHOPT    ,MUIA_Group_ActivePage, m = Mode2Group[rule->Field[i]]);
  182.          nnset(sg->CY_COMP[m], MUIA_Cycle_Active, rule->Comparison[i]);
  183.          if (sg->ST_MATCH[m]) nnset(sg->ST_MATCH[m], MUIA_String_Contents, rule->Match[i]);
  184.          else for (k = 0; k < 8; k++) if (!stricmp(rule->Match[i], Status[k])) nnset(sg->CY_STATUS, MUIA_Cycle_Active, k);
  185.          if (sg->CH_CASESENS[m]) nnset(sg->CH_CASESENS[m], MUIA_Selected, rule->CaseSens[i]);
  186.          if (sg->CH_SUBSTR[m]) nnset(sg->CH_SUBSTR[m], MUIA_Selected, rule->Substring[i]);
  187.       }
  188.    }
  189.    CO_RuleGhost(gui, rule);
  190. }
  191. MakeHook(CO_GetRUEntryHook,CO_GetRUEntry);
  192.  
  193. ///
  194. /// CO_PutRUEntry
  195. //  Fills form data into selected list entry
  196. void SAVEDS CO_PutRUEntry(void)
  197. {
  198.    struct Rule *rule = NULL;
  199.    struct CO_GUIData *gui = &G->CO->GUI;
  200.    char *tx;
  201.  
  202.    DoMethod(gui->LV_RULES, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &rule);
  203.    if (rule)
  204.    {
  205.       int i, m, rm = GetMUICheck(gui->CH_REMOTE);
  206.       
  207.       GetMUIString(rule->Name, gui->ST_RNAME);
  208.       rule->Remote = rm == 1;
  209.       rule->ApplyToNew  = GetMUICheck(gui->CH_APPLYNEW);
  210.       rule->ApplyToSent = GetMUICheck(gui->CH_APPLYSENT);
  211.       rule->ApplyOnReq  = GetMUICheck(gui->CH_APPLYREQ);
  212.       rule->Combine     = GetMUICycle(gui->CY_COMBINE[rm]);
  213.       rule->Actions = 0;
  214.       if (GetMUICheck(gui->CH_ABOUNCE))    rule->Actions |= 1;
  215.       if (GetMUICheck(gui->CH_AFORWARD))   rule->Actions |= 2;
  216.       if (GetMUICheck(gui->CH_ARESPONSE))  rule->Actions |= 4;
  217.       if (GetMUICheck(gui->CH_AEXECUTE))   rule->Actions |= 8;
  218.       if (GetMUICheck(gui->CH_APLAY))      rule->Actions |= 16;
  219.       if (GetMUICheck(gui->CH_AMOVE))      rule->Actions |= 32;
  220.       if (GetMUICheck(gui->CH_ADELETE))    rule->Actions |= 64;
  221.       if (GetMUICheck(gui->CH_ASKIP))      rule->Actions |= 128;
  222.       GetMUIString(rule->BounceTo,   gui->ST_ABOUNCE);
  223.       GetMUIString(rule->ForwardTo , gui->ST_AFORWARD);
  224.       GetMUIString(rule->ReplyFile , gui->ST_ARESPONSE);
  225.       GetMUIString(rule->ExecuteCmd, gui->ST_AEXECUTE);
  226.       GetMUIString(rule->PlaySound,  gui->ST_APLAY);
  227.       get(gui->TX_MOVETO, MUIA_Text_Contents, &tx); strcpy(rule->MoveTo, tx);
  228.       for (i = 0; i < 2; i++)
  229.       {
  230.          struct SearchGroup *sg = &(gui->GR_SEARCH[i+2*rm]);
  231.          get(sg->PG_SRCHOPT, MUIA_Group_ActivePage, &m);
  232.          rule->Field[i]      = GetMUICycle(sg->CY_MODE);
  233.          rule->SubField[i]   = GetMUIRadio(sg->RA_ADRMODE);
  234.          GetMUIString(rule->CustomField[i], sg->ST_FIELD);
  235.          rule->Comparison[i] = GetMUICycle(sg->CY_COMP[m]);
  236.          if (sg->ST_MATCH[m]   ) GetMUIString(rule->Match[i], sg->ST_MATCH[m]);
  237.                            else  strcpy(rule->Match[i], Status[GetMUICycle(sg->CY_STATUS)]);
  238.         if (sg->CH_CASESENS[m]) rule->CaseSens[i]  = GetMUICheck(sg->CH_CASESENS[m]);
  239.         if (sg->CH_SUBSTR[m]  ) rule->Substring[i] = GetMUICheck(sg->CH_SUBSTR[m]);
  240.       }
  241.       CO_RuleGhost(gui, rule);
  242.       DoMethod(gui->LV_RULES, MUIM_List_Redraw, MUIV_List_Redraw_Active);
  243.    }
  244. }
  245. MakeHook(CO_PutRUEntryHook,CO_PutRUEntry);
  246.  
  247. ///
  248. /// CO_RemoteToggleFunc
  249. //  Enables/disables GUI elements for remote filters
  250. void SAVEDS ASM CO_RemoteToggleFunc(REG(a1,int *arg))
  251. {
  252.    BOOL rm = *arg;
  253.    struct CO_GUIData *gui = &G->CO->GUI;
  254.    struct SearchGroup *src, *dst;
  255.    int i, m;
  256.  
  257.    set(gui->GR_LRGROUP, MUIA_Group_ActivePage, rm);
  258.    nnset(gui->CY_COMBINE[rm], MUIA_Cycle_Active, GetMUICycle(gui->CY_COMBINE[!rm]));
  259.    for (i = 0; i < 2; i++)
  260.    {
  261.       src = &(gui->GR_SEARCH[i+2*(!rm)]); dst = &(gui->GR_SEARCH[i+2*rm]);
  262.       nnset(dst->CY_MODE, MUIA_Cycle_Active, GetMUICycle(src->CY_MODE));
  263.       nnset(dst->RA_ADRMODE, MUIA_Radio_Active, GetMUIRadio(src->RA_ADRMODE));
  264.       nnset(dst->ST_FIELD, MUIA_String_Contents, GetMUIStringPtr(src->ST_FIELD));
  265.       for (m = 0; m < 5; m++)
  266.       {
  267.          nnset(dst->CY_COMP[m], MUIA_Cycle_Active, GetMUICycle(src->CY_COMP[m]));
  268.          if (src->ST_MATCH[m]) nnset(dst->ST_MATCH[m], MUIA_String_Contents, GetMUIStringPtr(src->ST_MATCH[m]));
  269.                           else nnset(dst->CY_STATUS, MUIA_Cycle_Active, GetMUICycle(src->CY_STATUS));
  270.          if (src->CH_CASESENS[m]) nnset(dst->CH_CASESENS[m], MUIA_Selected, GetMUICheck(src->CH_CASESENS[m]));
  271.          if (src->CH_SUBSTR[m]  ) nnset(dst->CH_SUBSTR[m]  , MUIA_Selected, GetMUICheck(src->CH_SUBSTR[m]));
  272.       }
  273.    }
  274.    CO_PutRUEntry();
  275. }
  276. MakeHook(CO_RemoteToggleHook,CO_RemoteToggleFunc);
  277. ///
  278.  
  279. /**** POP3 servers ****/
  280. /// CO_NewPOP3
  281. //  Initializes a new POP3 account
  282. struct POP3 *CO_NewPOP3(struct Config *co, BOOL first)
  283. {
  284.    struct POP3 *pop3;
  285.    if (pop3 = calloc(1, sizeof(struct POP3)))
  286.    {
  287.       if (first)
  288.       {
  289.          char *p, buffer[SIZE_USERID];
  290.          stccpy(buffer, co->EmailAddress, SIZE_USERID);
  291.          if (p = strchr(buffer, '@')) *p = 0;
  292.          strcpy(pop3->User, buffer);
  293.          strcpy(pop3->Server, co->SMTP_Server);
  294.       }
  295.       pop3->Enabled = TRUE;
  296.       pop3->DeleteOnServer = TRUE;
  297.    }
  298.    return pop3;
  299. }
  300.  
  301. ///
  302. /// CO_AddPOP3
  303. //  Adds a new entry to the POP3 account list
  304. void SAVEDS CO_AddPOP3(void)
  305. {
  306.    int i;
  307.    for (i = 0; i < MAXP3; i++)
  308.       if (!CE->P3[i])
  309.       {
  310.          CE->P3[i] = CO_NewPOP3(CE, i == 0);
  311.          DoMethod(G->CO->GUI.LV_POP3, MUIM_List_InsertSingle, CE->P3[i], MUIV_List_Insert_Bottom);
  312.          set(G->CO->GUI.LV_POP3, MUIA_List_Active, i);
  313.          set(G->CO->GUI.WI, MUIA_Window_ActiveObject, G->CO->GUI.ST_POPHOST);
  314.          break; 
  315.       }
  316. }
  317. MakeHook(CO_AddPOP3Hook,CO_AddPOP3);
  318.  
  319. ///
  320. /// CO_DelPOP3
  321. //  Deletes an entry from the POP3 account list
  322. void SAVEDS CO_DelPOP3(void)
  323. {
  324.    int i, p, e;
  325.    struct CO_GUIData *gui = &G->CO->GUI;
  326.  
  327.    get(gui->LV_POP3, MUIA_List_Active, &p);
  328.    get(gui->LV_POP3, MUIA_List_Entries, &e);
  329.    if (p != MUIV_List_Active_Off && e > 1)
  330.    {
  331.       DoMethod(gui->LV_POP3, MUIM_List_Remove, p);
  332.       for (i = p+1; i < MAXP3; i++) CE->P3[i-1] = CE->P3[i];
  333.       CE->P3[i-1] = NULL;
  334.    }
  335. }
  336. MakeHook(CO_DelPOP3Hook,CO_DelPOP3);
  337.  
  338. ///
  339. /// CO_GetP3Entry
  340. //  Fills form with data from selected list entry
  341. void SAVEDS CO_GetP3Entry(void)
  342. {
  343.    int e;
  344.    struct POP3 *pop3 = NULL;
  345.    struct CO_GUIData *gui = &G->CO->GUI;
  346.  
  347.    DoMethod(gui->LV_POP3, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &pop3);
  348.    if (pop3)
  349.    {
  350.       nnset(gui->ST_POPHOST,   MUIA_String_Contents, pop3->Server);
  351.       nnset(gui->ST_POPUSERID, MUIA_String_Contents, pop3->User);
  352.       nnset(gui->ST_PASSWD,    MUIA_String_Contents, pop3->Password);
  353.       nnset(gui->CH_POPENABLED,MUIA_Selected, pop3->Enabled);
  354.       nnset(gui->CH_USEAPOP,   MUIA_Selected, pop3->UseAPOP);
  355.       nnset(gui->CH_DELETE,    MUIA_Selected, pop3->DeleteOnServer);
  356.    }
  357.    get(gui->LV_POP3, MUIA_List_Entries, &e);
  358.    set(gui->GR_POP3, MUIA_Disabled, !pop3);
  359.    set(gui->BT_PDEL, MUIA_Disabled, !pop3 || e < 2);
  360. }
  361. MakeHook(CO_GetP3EntryHook,CO_GetP3Entry);
  362.  
  363. ///
  364. /// CO_PutP3Entry
  365. //  Fills form data into selected list entry
  366. void SAVEDS CO_PutP3Entry(void)
  367. {
  368.    struct POP3 *pop3 = NULL;
  369.    struct CO_GUIData *gui = &G->CO->GUI;
  370.    int p;
  371.  
  372.    get(gui->LV_POP3, MUIA_List_Active, &p);
  373.    if (p != MUIV_List_Active_Off)
  374.    {
  375.       DoMethod(gui->LV_POP3, MUIM_List_GetEntry, p, &pop3);
  376.       GetMUIString(pop3->Server, gui->ST_POPHOST);
  377.       GetMUIString(pop3->User, gui->ST_POPUSERID);
  378.       GetMUIString(pop3->Password, gui->ST_PASSWD);
  379.       pop3->Enabled        = GetMUICheck(gui->CH_POPENABLED);
  380.       pop3->UseAPOP        = GetMUICheck(gui->CH_USEAPOP);
  381.       pop3->DeleteOnServer = GetMUICheck(gui->CH_DELETE);
  382.       sprintf(pop3->Account, "%s@%s", pop3->User, pop3->Server);
  383.       DoMethod(gui->LV_POP3, MUIM_List_Redraw, p);
  384.    }
  385. }
  386. MakeHook(CO_PutP3EntryHook,CO_PutP3Entry);
  387.  
  388. ///
  389. /// CO_GetDefaultPOPFunc
  390. //  Sets values of first POP3 account
  391. void SAVEDS CO_GetDefaultPOPFunc(void)
  392. {
  393.    struct POP3 *pop3 = CE->P3[0];
  394.  
  395.    if (!pop3) return;
  396.    GetMUIString(pop3->Server, G->CO->GUI.ST_POPHOST0);
  397.    GetMUIString(pop3->Password, G->CO->GUI.ST_PASSWD0);
  398.    sprintf(pop3->Account, "%s@%s", pop3->User, pop3->Server);
  399. }
  400. MakeHook(CO_GetDefaultPOPHook,CO_GetDefaultPOPFunc);
  401. ///
  402.  
  403. /**** Mime Viewers ****/
  404. /// CO_NewMimeView
  405. //  Initializes a new MIME viewer
  406. struct MimeView *CO_NewMimeView(void)
  407. {
  408.    struct MimeView *mv;
  409.    if (mv = calloc(1, sizeof(struct MimeView)))
  410.    {
  411.       stccpy(mv->ContentType, "?/?", SIZE_CTYPE);
  412.    }
  413.    return mv;
  414. }
  415.  
  416. ///
  417. /// CO_AddMimeView
  418. //  Adds a new entry to the MIME viewer list
  419. void SAVEDS CO_AddMimeView(void)
  420. {
  421.    struct CO_GUIData *gui = &G->CO->GUI;
  422.    int i;
  423.    for (i = 0; i < MAXMV; i++)
  424.       if (!CE->MV[i])
  425.       {
  426.          CE->MV[i] = CO_NewMimeView();
  427.          DoMethod(gui->LV_MIME, MUIM_List_InsertSingle, CE->MV[i], MUIV_List_Insert_Bottom);
  428.          set(gui->LV_MIME, MUIA_List_Active, MUIV_List_Active_Bottom);
  429.          set(gui->WI, MUIA_Window_ActiveObject, gui->ST_CTYPE);
  430.          break; 
  431.       }
  432. }
  433. MakeHook(CO_AddMimeViewHook,CO_AddMimeView);
  434.  
  435. ///
  436. /// CO_DelMimeView
  437. //  Deletes an entry from the MIME viewer list
  438. void SAVEDS CO_DelMimeView(void)
  439. {
  440.    int i, p;
  441.    get(G->CO->GUI.LV_MIME, MUIA_List_Active, &p);
  442.    if (p != MUIV_List_Active_Off)
  443.    {
  444.       DoMethod(G->CO->GUI.LV_MIME, MUIM_List_Remove, p);
  445.       for (i = p+1; i < MAXMV-1; i++) CE->MV[i] = CE->MV[i+1];
  446.       CE->MV[i] = 0;
  447.    }
  448. }
  449. MakeHook(CO_DelMimeViewHook,CO_DelMimeView);
  450.  
  451. ///
  452. /// CO_GetMVEntry
  453. //  Fills form with data from selected list entry
  454. void SAVEDS CO_GetMVEntry(void)
  455. {
  456.    struct MimeView *mv = NULL;
  457.    struct CO_GUIData *gui = &G->CO->GUI;
  458.    int act = 0;
  459.  
  460.    DoMethod(gui->LV_MIME, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &mv);
  461.    if (mv)
  462.    {
  463.       nnset(gui->ST_CTYPE, MUIA_String_Contents, mv->ContentType);
  464.       nnset(gui->ST_EXTENS, MUIA_String_Contents, mv->Extension);
  465.       nnset(gui->ST_COMMAND, MUIA_String_Contents, mv->Command);
  466.       get(gui->LV_MIME, MUIA_List_Active, &act);
  467.    }
  468.    set(gui->GR_MIME, MUIA_Disabled, !mv);
  469.    set(gui->BT_MDEL, MUIA_Disabled, !mv);
  470. }
  471. MakeHook(CO_GetMVEntryHook,CO_GetMVEntry);
  472.  
  473. ///
  474. /// CO_PutMVEntry
  475. //  Fills form data into selected list entry
  476. void SAVEDS CO_PutMVEntry(void)
  477. {
  478.    struct MimeView *mv = NULL;
  479.    struct CO_GUIData *gui = &G->CO->GUI;
  480.  
  481.    DoMethod(gui->LV_MIME, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &mv);
  482.    if (mv)
  483.    {
  484.       GetMUIString(mv->ContentType, gui->ST_CTYPE);
  485.       GetMUIString(mv->Extension, gui->ST_EXTENS);
  486.       GetMUIString(mv->Command, gui->ST_COMMAND);
  487.       DoMethod(gui->LV_MIME, MUIM_List_Redraw, MUIV_List_Redraw_Active);
  488.    }
  489. }
  490. MakeHook(CO_PutMVEntryHook,CO_PutMVEntry);
  491. ///
  492.  
  493. /**** ARexx Hooks ****/
  494. /// CO_GetRXEntry
  495. //  Fills form with data from selected list entry
  496. void SAVEDS CO_GetRXEntry(void)
  497. {
  498.    int act;
  499.    struct CO_GUIData *gui = &G->CO->GUI;
  500.    struct RxHook *rh;
  501.    get(gui->LV_REXX, MUIA_List_Active, &act);
  502.    rh = &(CE->RX[act]);
  503.    nnset(gui->ST_RXNAME, MUIA_String_Contents, act < 10 ? rh->Name : "");
  504.    nnset(gui->ST_SCRIPT, MUIA_String_Contents, rh->Script);
  505.    nnset(gui->CY_ISADOS, MUIA_Cycle_Active, rh->IsAmigaDOS ? 1 : 0);
  506.    nnset(gui->CH_CONSOLE, MUIA_Selected, rh->UseConsole);
  507.    nnset(gui->CH_WAITTERM, MUIA_Selected, rh->WaitTerm);
  508.    set(gui->ST_RXNAME, MUIA_Disabled, act >= 10);
  509.    DoMethod(gui->LV_REXX, MUIM_List_Redraw, act);
  510. }
  511. MakeHook(CO_GetRXEntryHook,CO_GetRXEntry);
  512.  
  513. ///
  514. /// CO_PutRXEntry
  515. //  Fills form data into selected list entry
  516. void SAVEDS CO_PutRXEntry(void)
  517. {
  518.    int act;
  519.    struct CO_GUIData *gui = &G->CO->GUI;
  520.    get(gui->LV_REXX, MUIA_List_Active, &act);
  521.    if (act != MUIV_List_Active_Off)
  522.    {
  523.       struct RxHook *rh = &(CE->RX[act]);
  524.       GetMUIString(rh->Name, gui->ST_RXNAME);
  525.       GetMUIString(rh->Script, gui->ST_SCRIPT);
  526.       rh->IsAmigaDOS = GetMUICycle(gui->CY_ISADOS) == 1;
  527.       rh->UseConsole = GetMUICheck(gui->CH_CONSOLE);
  528.       rh->WaitTerm = GetMUICheck(gui->CH_WAITTERM);
  529.    }
  530. }
  531. MakeHook(CO_PutRXEntryHook,CO_PutRXEntry);
  532. ///
  533.  
  534. /// CO_IsValid
  535. //  Verifies if the required settings have been made
  536. BOOL CO_IsValid(void)
  537. {
  538.    if (G->CO_Valid) return TRUE;
  539.    if (G->CO) set(G->CO->GUI.WI,MUIA_Window_Open,TRUE);
  540.    else DoMethod(G->App, MUIM_CallHook, &CO_OpenHook);
  541.    MUI_Request(G->App, G->MA->GUI.WI, 0, NULL, GetStr(MSG_OkayReq), GetStr(MSG_CO_InvalidConf));
  542.    return FALSE;
  543. }
  544.  
  545. ///
  546. /// CO_DetectPGP
  547. //  Checks if PGP 2 or 5 is available
  548. LOCAL int CO_DetectPGP(struct Config *co)
  549. {
  550.    if (PFExists(co->PGPCmdPath, "pgpe")) return 5;
  551.    else if (PFExists(co->PGPCmdPath, "pgp")) return 2;
  552.    return 0;
  553. }
  554.  
  555. ///
  556. /// CO_FreeConfig
  557. //  Deallocates a configuration structure
  558. void CO_FreeConfig(struct Config *co)
  559. {
  560.    int i;
  561.    for (i = 0; i < MAXP3; i++) if (co->P3[i]) free(co->P3[i]);
  562.    for (i = 0; i < MAXRU; i++) if (co->RU[i]) free(co->RU[i]);
  563.    for (i = 0; i < MAXMV; i++) if (co->MV[i]) free(co->MV[i]);
  564.    clear(co, sizeof(struct Config));
  565. }  
  566.  
  567. ///
  568. /// CO_SetDefaults
  569. //  Sets configuration (or a part of it) to the factory settings
  570. void CO_SetDefaults(struct Config *co, int page)
  571. {
  572.    int i;
  573.    
  574.    if (page == 0 || page < 0)
  575.    {
  576.       *co->RealName = *co->EmailAddress = 0;
  577.       co->TimeZone = G->Locale ? -G->Locale->loc_GMTOffset/60 : 0;
  578.       co->DaylightSaving = 0;
  579.    }
  580.    if (page == 1 || page < 0)
  581.    {
  582.       for (i = 0; i < MAXP3; i++) { if (co->P3[i]) free(co->P3[i]); co->P3[i] = NULL; }
  583.       *co->SMTP_Server = *co->SMTP_Domain = 0;
  584.       co->Allow8bit = FALSE;
  585.       co->Use_SMTP_AUTH = FALSE;
  586.       *co->SMTP_AUTH_User = *co->SMTP_AUTH_Pass = 0;
  587.       co->P3[0] = CO_NewPOP3(co, TRUE); co->P3[0]->DeleteOnServer = TRUE;
  588.    }
  589.    if (page == 2 || page < 0)
  590.    {
  591.       co->AvoidDuplicates = FALSE;
  592.       co->TransferWindow = 2;
  593.       co->UpdateStatus = co->DownloadLarge = TRUE;
  594.       co->PreSelection = 1;
  595.       co->WarnSize = 100;
  596.       co->CheckMailDelay = 0;
  597.       co->NotifyType = 1;
  598.       *co->NotifySound = *co->NotifyCommand = 0;
  599.    }
  600.    if (page == 3 || page < 0)
  601.    {
  602.       for (i = 0; i < MAXRU; i++) { if (co->RU[i]) free(co->RU[i]); co->RU[i] = NULL; }
  603.    }
  604.    if (page == 4 || page < 0)
  605.    {
  606.       for (i = 0; i < MAXMV; i++) { if (co->MV[i]) free(co->MV[i]); co->MV[i] = NULL; }
  607.       co->ShowHeader = 1;
  608.       strcpy(co->ShortHeaders,"(From|To|Date|Subject)");
  609.       co->ShowSenderInfo = 2;
  610.       strcpy(co->ColoredText.buf, "m6");
  611.       strcpy(co->Color2ndLevel.buf, "m7");
  612.       co->DisplayAllTexts = co->FixedFontEdit = co->UseTextstyles = TRUE;
  613.       co->WrapHeader = co->MultipleWindows = FALSE;
  614.       co->SigSepLine = 2;
  615.       *co->TranslationIn = 0;
  616.    }
  617.    if (page == 5 || page < 0)
  618.    {
  619.       *co->ReplyTo = *co->Organization = *co->ExtraHeaders = *co->TranslationOut = 0;
  620.       strcpy(co->NewIntro, GetStr(MSG_CO_NewIntroDef));
  621.       strcpy(co->Greetings, GetStr(MSG_CO_GreetingsDef));
  622.       co->EdWrapCol = 76;
  623.       co->EdWrapMode = 2;
  624.       strcpy(co->Editor, "C:Ed");
  625.       co->LaunchAlways = FALSE;
  626.    }
  627.    if (page == 6 || page < 0)
  628.    {
  629.       strcpy(co->ReplyHello, "Hello %f\\n");
  630.       strcpy(co->ReplyIntro, "On %d, you wrote:\\n");
  631.       strcpy(co->ReplyBye, "Regards");
  632.       strcpy(co->AltReplyHello, GetStr(MSG_CO_AltRepHelloDef));
  633.       strcpy(co->AltReplyIntro, GetStr(MSG_CO_AltRepIntroDef));
  634.       strcpy(co->AltReplyBye, GetStr(MSG_CO_AltRepByeDef));
  635.       strcpy(co->AltReplyPattern, GetStr(MSG_CO_AltRepPatternDef));
  636.       strcpy(co->MLReplyHello, GetStr(MSG_CO_MLRepHelloDef));
  637.       strcpy(co->MLReplyIntro, GetStr(MSG_CO_MLRepIntroDef));
  638.       strcpy(co->MLReplyBye, GetStr(MSG_CO_MLRepByeDef));
  639.       strcpy(co->ForwardIntro, GetStr(MSG_CO_ForwardIntroDef));
  640.       strcpy(co->ForwardFinish, GetStr(MSG_CO_ForwardFinishDef));
  641.       co->QuoteMessage = co->QuoteEmptyLines = co->CompareAddress = co->StripSignature = TRUE;
  642.       strcpy(co->QuoteText, ">");
  643.       strcpy(co->AltQuoteText, "|");
  644.    }
  645.    if (page == 7 || page < 0)
  646.    {
  647.       co->UseSignature = FALSE;
  648.       strmfp(co->TagsFile, G->ProgDir, ".taglines");
  649.       strcpy(co->TagsSeparator, "%%");
  650.    }
  651.    if (page == 8 || page < 0)
  652.    {
  653.       co->FolderCols = 1+2+16;
  654.       co->MessageCols = 1+2+8+16;      
  655.       co->FixedFontList = C->SwatchBeat = FALSE;
  656.    }
  657.    if (page == 9 || page < 0)
  658.    {
  659.       G->PGPVersion = 0;
  660.       if (GetVar("PGPPATH", co->PGPCmdPath, SIZE_PATH, 0) >= 0) G->PGPVersion = CO_DetectPGP(co);
  661.       if (!G->PGPVersion)
  662.       {
  663.          strcpy(co->PGPCmdPath, "C:");
  664.          G->PGPVersion = CO_DetectPGP(co);
  665.       }
  666.       *co->MyPGPID = 0;
  667.       co->EncryptToSelf = co->LogAllEvents = TRUE;
  668.       strcpy(co->ReMailer, "Remailer <remailer@replay.com>");
  669.       strcpy(co->RMCommands, "Anon-to: %s");
  670.       strcpy(co->LogfilePath, G->ProgDir);
  671.       co->LogfileMode = 1;
  672.       co->SplitLogfile = FALSE;
  673.    }
  674.    if (page == 10 || page < 0)
  675.    {
  676.       co->GetOnStartup = co->SendOnStartup = co->LoadAllFolders = co->SendOnQuit = FALSE;
  677.       co->CleanupOnStartup = co->RemoveOnStartup = FALSE;
  678.       co->UpdateNewMail = co->CheckBirthdates = co->CleanupOnQuit = co->RemoveOnQuit = TRUE;
  679.    }
  680.    if (page == 11 || page < 0)
  681.    {
  682.       co->MV[0] = CO_NewMimeView();
  683.       strcpy(co->MV[0]->ContentType, GetStr(MSG_Default));
  684.       strcpy(co->MV[0]->Command, "SYS:Utilities/Multiview \"%s\"");
  685.       co->IdentifyBin = TRUE;
  686.       strcpy(co->DetachDir, "RAM:");
  687.       strcpy(co->AttachDir, "RAM:");
  688.    }
  689.    if (page == 12 || page < 0)
  690.    {
  691.       strcpy(co->GalleryDir, "YAM:Gallery");
  692.       strcpy(co->NewAddrGroup, "NEW");
  693.       co->AddMyInfo = FALSE;
  694.       co->AddToAddrbook = 0;
  695.       co->AddrbookCols = 1+2+4;
  696.    }
  697.    if (page == 13 || page < 0)
  698.    {
  699.       for (i = 0; i < MAXRX; i++)
  700.       {
  701.          *co->RX[i].Name = *co->RX[i].Script = 0;
  702.          co->RX[i].IsAmigaDOS = co->RX[i].UseConsole = FALSE;
  703.          co->RX[i].WaitTerm = TRUE;
  704.       }
  705.    }
  706.    if (page == 14 || page < 0)
  707.    {
  708.       strcpy(co->TempDir, "T:");
  709.       strcpy(co->PackerCommand,"LhA -a -m -i%l a \"%a\"");
  710.       co->IconPositionX = co->IconPositionY = 0;
  711.       co->IconifyOnQuit = co->RemoveAtOnce = FALSE;
  712.       co->Confirm = co->SaveSent = co->SendMDNAtOnce = TRUE;
  713.       co->ConfirmDelete = 2;
  714.       co->MDN_Display = co->MDN_Process = co->MDN_Delete = 2;
  715.       co->MDN_Filter = 3;
  716.       strcpy(co->XPKPack, "HUFF");
  717.       strcpy(co->XPKPackEncrypt, "HUFF");
  718.       co->XPKPackEff = 50;
  719.       co->XPKPackEncryptEff = 50;
  720.    }
  721.    if (page < 0)
  722.    {
  723.       co->LetterPart = 1;
  724.       co->WriteIndexes = 120;
  725.       co->AutoSave = 600;
  726.       strcpy(co->SupportSite, "http://www.yam.ch/");
  727.       co->JumpToNewMsg = co->AskJumpUnread = co->WarnSubject = co->PrinterCheck = co->IsOnlineCheck = TRUE;
  728.       co->ConfirmOnQuit = FALSE;
  729.       co->HideGUIElements = 0;
  730.       strcpy(co->LocalCharset, "iso-8859-1");
  731.         co->PrintMethod = PRINTMETHOD_DUMPRAW;
  732.       co->StackSize = 40000;
  733.    }
  734. }
  735.  
  736. ///
  737. /// CO_CopyConfig
  738. //  Copies a configuration structure
  739. LOCAL void CO_CopyConfig(struct Config *dco, struct Config *sco)
  740. {
  741.    int i;
  742.    memcpy(dco, sco, sizeof(struct Config));
  743.    for (i = 0; i < MAXP3; i++) dco->P3[i] = sco->P3[i] ? (struct POP3     *)AllocCopy(sco->P3[i], sizeof(struct POP3)) : NULL;
  744.    for (i = 0; i < MAXRU; i++) dco->RU[i] = sco->RU[i] ? (struct Rule     *)AllocCopy(sco->RU[i], sizeof(struct Rule)) : NULL;
  745.    for (i = 0; i < MAXMV; i++) dco->MV[i] = sco->MV[i] ? (struct MimeView *)AllocCopy(sco->MV[i], sizeof(struct MimeView)) : NULL;
  746. }
  747.  
  748. ///
  749. /// CO_Validate
  750. //  Validates a configuration, update GUI etc.
  751. void CO_Validate(struct Config *co, BOOL update)
  752. {
  753.    char *p, buffer[SIZE_USERID];
  754.    int i;
  755.    if (!*co->SMTP_Server) strcpy(co->SMTP_Server, co->P3[0]->Server);
  756.    if (!*co->SMTP_Domain) { p = strchr(co->EmailAddress, '@'); strcpy(co->SMTP_Domain, p ? p+1 : ""); }
  757.    for (i = 0; i < MAXP3; i++) if (co->P3[i])
  758.    {
  759.       if (!*co->P3[i]->Server) strcpy(co->P3[i]->Server, co->SMTP_Server);
  760.       if (!*co->P3[i]->User)
  761.       {
  762.          stccpy(buffer, co->EmailAddress, SIZE_USERID);
  763.          if (p = strchr(buffer, '@')) *p = 0;
  764.          strcpy(co->P3[i]->User, buffer);
  765.       }
  766.       sprintf(co->P3[i]->Account, "%s@%s", co->P3[i]->User, co->P3[i]->Server);
  767.    }
  768.    if (G->CO_DST) co->DaylightSaving = G->CO_DST==2;
  769.    G->PGPVersion = CO_DetectPGP(co);
  770.    CreateDirectory(co->TempDir);
  771.    strmfp(G->WR_Filename[0], co->TempDir, "NewLetter.yam");
  772.    strmfp(G->WR_Filename[1], co->TempDir, "NewLetter.1.yam");
  773.    strmfp(G->WR_Filename[2], co->TempDir, "NewLetter.2.yam");
  774.    LoadTranslationTable(&(G->TTin), co->TranslationIn);
  775.    LoadTranslationTable(&(G->TTout), co->TranslationOut);
  776.    G->CO_Valid = (*co->SMTP_Server && *co->EmailAddress && *co->RealName);
  777.    if (update && G->CO)
  778.    {
  779.       switch (G->CO->VisiblePage)
  780.       {
  781.          case 0:
  782.             setstring(G->CO->GUI.ST_POPHOST0, co->P3[0]->Server);
  783.             break;
  784.          case 1:
  785.             setstring(G->CO->GUI.ST_SMTPHOST, co->SMTP_Server);
  786.             setstring(G->CO->GUI.ST_DOMAIN, co->SMTP_Domain);
  787.             setstring(G->CO->GUI.ST_SMTPAUTHUSER, co->SMTP_AUTH_User);
  788.             setstring(G->CO->GUI.ST_SMTPAUTHPASS, co->SMTP_AUTH_Pass);
  789.             DoMethod(G->CO->GUI.LV_POP3, MUIM_List_Redraw, MUIV_List_Redraw_All);
  790.             break;
  791.       }
  792.       if (G->CO->Visited[1] || G->CO->Visited[13] || G->CO->UpdateAll) MA_SetupDynamicMenus();
  793.       if (G->CO->Visited[8] || G->CO->UpdateAll)
  794.       {
  795.          SaveLayout(FALSE);
  796.          MA_MakeFOFormat(G->MA->GUI.NL_FOLDERS);
  797.          MA_MakeMAFormat(G->MA->GUI.NL_MAILS);
  798.          LoadLayout();
  799.       }
  800.       if (G->CO->Visited[12] || G->CO->UpdateAll) AB_MakeABFormat(G->AB->GUI.LV_ADRESSES);
  801.       if (G->CO->Visited[14] || G->CO->UpdateAll) { SetupAppIcons(); G->TotMsgs = -1; DisplayStatistics(FO_GetFolderByType(FT_INCOMING, NULL)); }
  802.    }
  803. }
  804.  
  805. ///
  806. /// CO_ImportCTypes
  807. //  Imports MIME viewers from a MIME.prefs file
  808. void SAVEDS CO_ImportCTypesFunc(void)
  809. {
  810.    int mode;
  811.  
  812.    if (mode = MUI_Request(G->App, G->CO->GUI.WI, 0, GetStr(MSG_CO_ImportMIME), GetStr(MSG_CO_ImportMIMEGads), GetStr(MSG_CO_ImportMIMEReq)))
  813.       if (ReqFile(ASL_CONFIG,G->CO->GUI.WI, "Import MIME viewers & types", 0, (mode == 1 ? "ENV:" : G->MA_MailDir), (mode == 1 ? "MIME.prefs" : (mode == 2 ? "mailcap" : "mime.types"))))
  814.       {
  815.          char buffer[SIZE_LARGE], fname[SIZE_PATHFILE], *p, *p2;
  816.          struct MimeView *mv;
  817.          APTR lv = G->CO->GUI.LV_MIME;
  818.          int i;
  819.          FILE *fh;
  820.          strmfp(fname, G->ASLReq[ASL_CONFIG]->fr_Drawer, G->ASLReq[ASL_CONFIG]->fr_File);
  821.          if (fh = fopen(fname, "r"))
  822.          {
  823.             set(lv, MUIA_List_Quiet, TRUE);
  824.             while (fgets(buffer, SIZE_LARGE, fh))
  825.             {
  826.                char *ctype = buffer, *ext = "", *command = "";
  827.                if (p = strpbrk(ctype, "\r\n")) *p = 0;
  828.                if (!*ctype || ISpace(*ctype)) continue;
  829.                if (mode == 1)
  830.                {
  831.                   if (*ctype == ';') continue;
  832.                   for (p = ctype; *p && *p != ','; ++p);
  833.                   if (*p)
  834.                   {
  835.                      for (*p = 0, ext = ++p; *p && *p != ','; ++p);
  836.                      if (*p)
  837.                      {
  838.                         for (*p++ = 0; *p && *p != ','; ++p);
  839.                         if (*p)
  840.                         {
  841.                            for (command = ++p; *p && *p != ','; ++p);
  842.                            *p = 0;
  843.                         }
  844.                      }
  845.                   }
  846.                }
  847.                else if (mode == 2)
  848.                {
  849.                   if (*ctype == '#') continue;
  850.                   for (p2 = p = ctype; !ISpace(*p) && *p && *p != ';'; p2 = ++p);
  851.                   if (p = strpbrk(p,";")) ++p;
  852.                   if (p) command = stpblk(p);
  853.                   *p2 = 0;
  854.                }
  855.                else
  856.                {
  857.                   if (*ctype == '#') continue;
  858.                   for (p2 = p = ctype; !ISpace(*p) && *p; p2 = ++p);
  859.                   if (*p) ext = stpblk(p);
  860.                   *p2 = 0;
  861.                }
  862.                for (mv = NULL, i = 0; i < MAXMV; i++) if (CE->MV[i]) if (!stricmp(CE->MV[i]->ContentType, ctype)) { mv = CE->MV[i]; break; }
  863.                if (!mv) for (i = 0; i < MAXMV; i++) if (!CE->MV[i])
  864.                {
  865.                   mv = CE->MV[i] = CO_NewMimeView();
  866.                   DoMethod(lv, MUIM_List_InsertSingle, mv, MUIV_List_Insert_Bottom);
  867.                   break;
  868.                }
  869.                if (mv)
  870.                {
  871.                   for (p = mv->ContentType; *ctype && strlen(mv->ContentType) < SIZE_CTYPE; ctype++)
  872.                      if (*ctype == '*') { *p++ = '#'; *p++ = '?'; } else *p++ = *ctype;
  873.                   *p = 0;
  874.                   if (*command)
  875.                   {
  876.                      for (p = mv->Command; *command && strlen(mv->Command) < SIZE_COMMAND; command++)
  877.                         if (*command == '%' && command[1] == 'f') { *p++ = *command++; *p++ = 's'; } else *p++ = *command;
  878.                      *p = 0;
  879.                   }
  880.                   if (*ext) stccpy(mv->Extension, ext, SIZE_NAME);
  881.                }
  882.             }
  883.             fclose(fh);
  884.             set(lv, MUIA_List_Quiet, FALSE);
  885.             DoMethod(lv, MUIM_List_Redraw, MUIV_List_Redraw_All);
  886.          }
  887.          else ER_NewError(GetStr(MSG_ER_CantOpenFile), fname, NULL);
  888.       }
  889. }
  890. MakeHook(CO_ImportCTypesHook, CO_ImportCTypesFunc);
  891.  
  892. ///
  893. /// CO_EditSignatFunc
  894. //  Edits the signature file
  895. void SAVEDS ASM CO_EditSignatFunc(REG(a1,int *arg))
  896. {
  897.    int sig = GetMUICycle(G->CO->GUI.CY_SIGNAT), modified;
  898.    char buffer[SIZE_COMMAND+SIZE_PATHFILE];
  899.    APTR ed = G->CO->GUI.TE_SIGEDIT;
  900.  
  901.    get(ed, MUIA_TextEditor_HasChanged, &modified);
  902.    if (modified) EditorToFile(ed, CreateFilename(SigNames[G->CO->LastSig]), NULL);
  903.    if (*arg) if (*(CE->Editor))
  904.    {
  905.       sprintf(buffer,"%s \"%s\"", CE->Editor, CreateFilename(SigNames[sig]));
  906.       ExecuteCommand(buffer, FALSE, OUT_NIL);
  907.    } else return;
  908.    if (!FileToEditor(CreateFilename(SigNames[sig]), ed)) DoMethod(ed, MUIM_TextEditor_ClearText);
  909.    set(ed, MUIA_TextEditor_HasChanged, FALSE);
  910.    G->CO->LastSig = sig;
  911. }
  912. MakeHook(CO_EditSignatHook,CO_EditSignatFunc);
  913.  
  914. ///
  915. /// CO_OpenConfig
  916. //  Opens a different configuration file
  917. void SAVEDS CO_OpenConfig(void)
  918. {
  919.    if (ReqFile(ASL_CONFIG,G->CO->GUI.WI, GetStr(MSG_CO_Open), 0, G->MA_MailDir, ""))
  920.    {
  921.       char cname[SIZE_PATHFILE];
  922.       strmfp(cname, G->ASLReq[ASL_CONFIG]->fr_Drawer, G->ASLReq[ASL_CONFIG]->fr_File);
  923.       if (CO_LoadConfig(CE, cname, NULL)) CO_NewPrefsFile(cname);
  924.       CO_SetConfig();
  925.       G->CO->UpdateAll = TRUE;
  926.    }
  927. }
  928. MakeHook(CO_OpenConfigHook, CO_OpenConfig);
  929.  
  930. ///
  931. /// CO_SaveConfigAs
  932. //  Saves configuration to a file using an alternative name
  933. void SAVEDS CO_SaveConfigAs(void)
  934. {
  935.    if (ReqFile(ASL_CONFIG,G->CO->GUI.WI, GetStr(MSG_CO_SaveAs), 1, G->MA_MailDir, ""))
  936.    {
  937.       char cname[SIZE_PATHFILE];
  938.       strmfp(cname, G->ASLReq[ASL_CONFIG]->fr_Drawer, G->ASLReq[ASL_CONFIG]->fr_File);
  939.       CO_GetConfig();
  940.       CO_Validate(CE, TRUE);
  941.       CO_NewPrefsFile(cname);
  942.       CO_SaveConfig(CE, cname);
  943.    }
  944. }
  945. MakeHook(CO_SaveConfigAsHook, CO_SaveConfigAs);
  946.  
  947. ///
  948. /// CO_Restore
  949. //  Makes all changes undone
  950. void SAVEDS CO_Restore(void)
  951. {                    
  952.    CO_FreeConfig(CE);
  953.    CO_CopyConfig(CE, C);
  954.    CO_SetConfig();
  955. }
  956. MakeHook(CO_RestoreHook,CO_Restore);
  957.  
  958. ///
  959. /// CO_LastSaved
  960. //  Reloads configuration from file
  961. void SAVEDS CO_LastSaved(void)
  962. {
  963.    CO_LoadConfig(CE, G->CO_PrefsFile, NULL);
  964.    CO_SetConfig();
  965.    G->CO->UpdateAll = TRUE;
  966. }
  967. MakeHook(CO_LastSavedHook,CO_LastSaved);
  968.  
  969. ///
  970. /// CO_ResetToDefaultFunc
  971. //  Resets configuration (or a part of it)
  972. void SAVEDS ASM CO_ResetToDefaultFunc(REG(a1,int *arg))
  973. {
  974.    if (*arg) { CO_SetDefaults(CE, -1); G->CO->UpdateAll = TRUE; }
  975.    else CO_SetDefaults(CE, G->CO->VisiblePage);
  976.    CO_SetConfig();
  977. }
  978. MakeHook(CO_ResetToDefaultHook,CO_ResetToDefaultFunc);
  979.  
  980. ///
  981. /// CO_BuildPage
  982. //  Creates a GUI section of the configuration
  983. LOCAL APTR CO_BuildPage(struct CO_ClassData *data, int page)
  984. {
  985.    switch (page)
  986.    {
  987.       case  0: return CO_Page0(data);
  988.       case  1: return CO_Page1(data);
  989.       case  2: return CO_Page2(data);
  990.       case  3: return CO_Page3(data);
  991.       case  4: return CO_Page4(data);
  992.       case  5: return CO_Page5(data);
  993.       case  6: return CO_Page6(data);
  994.       case  7: return CO_Page7(data);
  995.       case  8: return CO_Page8(data);
  996.       case  9: return CO_Page9(data);
  997.       case 10: return CO_Page10(data);
  998.       case 11: return CO_Page11(data);
  999.       case 12: return CO_Page12(data);
  1000.       case 13: return CO_Page13(data);
  1001.       case 14: return CO_Page14(data);
  1002.    }
  1003.  
  1004.    return NULL;
  1005. }
  1006.  
  1007. ///
  1008. /// CO_ChangePageFunc
  1009. //  Selects a different section of the configuration
  1010. void SAVEDS ASM CO_ChangePageFunc(REG(a1,int *arg))
  1011. {
  1012.    struct CO_GUIData *gui = &G->CO->GUI;
  1013.    if (*arg < 0 || *arg >= MAXCPAGES) return;
  1014.    set(gui->WI, MUIA_Window_Sleep, TRUE);
  1015.    CO_GetConfig();
  1016.    if (DoMethod(gui->GR_PAGE, MUIM_Group_InitChange))
  1017.    {
  1018.       DoMethod(gui->GR_PAGE, OM_REMMEMBER, gui->GR_SUBPAGE);
  1019.       MUI_DisposeObject(gui->GR_SUBPAGE);
  1020.       if (gui->GR_SUBPAGE = CO_BuildPage(G->CO, *arg))
  1021.       {
  1022.          DoMethod(gui->GR_PAGE, OM_ADDMEMBER, gui->GR_SUBPAGE);
  1023.          G->CO->VisiblePage = *arg;
  1024.          G->CO->Visited[*arg] = TRUE;
  1025.       }
  1026.       DoMethod(gui->GR_PAGE, MUIM_Group_ExitChange);
  1027.       set(gui->MI_IMPMIME, MUIA_Menuitem_Enabled, *arg == 11);
  1028.       CO_SetConfig();
  1029.    }
  1030.    set(gui->WI, MUIA_Window_Sleep, FALSE);
  1031. }
  1032. MakeHook(CO_ChangePageHook,CO_ChangePageFunc);
  1033.  
  1034. ///
  1035. /// CO_CloseFunc
  1036. //  Closes configuration window
  1037. void SAVEDS ASM CO_CloseFunc(REG(a1,int *arg))
  1038. {
  1039.    if (*arg >= 1)
  1040.    {
  1041.       CO_GetConfig();
  1042.       CO_FreeConfig(C);
  1043.       CO_CopyConfig(C, CE);
  1044.       CO_Validate(C, TRUE);
  1045.       if (*arg == 2) CO_SaveConfig(C, G->CO_PrefsFile);
  1046.    }
  1047.    CO_FreeConfig(CE); free(CE);
  1048.    DisposeModulePush(&G->CO);
  1049. }
  1050. MakeHook(CO_CloseHook,CO_CloseFunc);
  1051.  
  1052. ///
  1053. /// CO_OpenFunc
  1054. //  Opens configuration window
  1055. void SAVEDS CO_OpenFunc(void)
  1056. {
  1057.    if (!G->CO)
  1058.    {
  1059.       if (!(G->CO = CO_New())) return;
  1060.       CE = malloc(sizeof(struct Config));
  1061.       CO_CopyConfig(CE, C);
  1062.       CO_SetConfig();
  1063.       CO_NewPrefsFile(G->CO_PrefsFile);
  1064.    }
  1065.    if (!SafeOpenWindow(G->CO->GUI.WI)) CO_CloseFunc(0);
  1066. }
  1067. MakeHook(CO_OpenHook,CO_OpenFunc);
  1068. ///
  1069.  
  1070. /*** GUI ***/
  1071.  
  1072. /// CO_PL_DspFunc
  1073. //  Section listview displayhook
  1074. long SAVEDS ASM CO_PL_DspFunc(REG(a0,struct Hook *hook), REG(a2,char **array), REG(a1,struct PageList *entry))
  1075. {
  1076.    static char page[SIZE_DEFAULT];
  1077.    struct PL_Data *data = (APTR)hook->h_Data;
  1078.    sprintf(array[0] = page, "\033O[%08lx] %s", data->Image[entry->Offset], GetStr(entry->PageLabel));
  1079.    return 0;
  1080. }
  1081.  
  1082. ///
  1083. /// Images
  1084. //  Images for section listview in ILBM/BODY format
  1085. const UBYTE PL_IconBody[MAXCPAGES][240] = {
  1086. { /* 0 */
  1087. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xff,0x00,0x01,0x10,0x00,0xff,0x00,0x01,0xf0,
  1088. 0x00,0xff,0x00,0x01,0x18,0x00,0xff,0x00,0x01,0xf8,0x00,0x03,0x00,0x01,0x88,
  1089. 0x00,0xfd,0x00,0x03,0x00,0x01,0xf0,0x00,0x03,0x00,0x03,0xc0,0x00,0xff,0x00,
  1090. 0x01,0x0c,0x00,0x03,0x00,0x02,0xe0,0x00,0x03,0x00,0x06,0x80,0x00,0x03,0x00,
  1091. 0x01,0x18,0x00,0x03,0x00,0x04,0xc0,0x00,0x03,0x00,0x0c,0x00,0x00,0x03,0x00,
  1092. 0x03,0x30,0x00,0x03,0x11,0x09,0x80,0x00,0x03,0x1f,0x1c,0x00,0x00,0x03,0x11,
  1093. 0x06,0x60,0x00,0x03,0x0f,0x93,0x00,0x00,0x03,0x00,0x3c,0x00,0x00,0x03,0x00,
  1094. 0x8c,0xc0,0x00,0x03,0x05,0xf6,0x00,0x00,0x03,0x03,0x38,0x00,0x00,0x03,0x01,
  1095. 0x59,0x80,0x00,0x03,0x03,0xfc,0x00,0x00,0x03,0x01,0xf0,0x00,0x00,0x03,0x01,
  1096. 0xb3,0x00,0x00,0x03,0x01,0xb8,0x00,0x00,0x03,0x00,0xe0,0x00,0x00,0x03,0x00,
  1097. 0xa6,0x00,0x00,0x03,0x00,0xb0,0x00,0x00,0x03,0x00,0x40,0x00,0x00,0x03,0x00,
  1098. 0x0c,0x00,0x00,0x03,0x00,0x60,0x00,0x00,0xfd,0x00,0x03,0x00,0x18,0x00,0x00,
  1099. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1100. { /* 1 */
  1101. 0x03,0x1c,0x00,0x70,0x00,0xfd,0x00,0x03,0x1c,0x00,0x70,0x00,0x03,0x22,0x00,
  1102. 0x88,0x00,0xfd,0x00,0x03,0x3e,0x00,0xf8,0x00,0x03,0x57,0xff,0x5c,0x00,0x03,
  1103. 0x1e,0x00,0x78,0x00,0x03,0x75,0xff,0xd4,0x00,0x03,0x4f,0xff,0x3c,0x00,0x03,
  1104. 0x1d,0xff,0x70,0x00,0x03,0x6c,0x00,0xb4,0x00,0x03,0x5a,0xfe,0xec,0x00,0x03,
  1105. 0x18,0x00,0xe0,0x00,0x03,0x7c,0xfe,0x74,0x00,0x03,0x3f,0x7d,0x78,0x00,0x03,
  1106. 0x13,0x01,0x48,0x00,0x03,0x20,0xfe,0x00,0x00,0x03,0x3f,0x45,0xf0,0x00,0x03,
  1107. 0x08,0x44,0x20,0x00,0x03,0x37,0x29,0xd0,0x00,0x03,0x3f,0xd7,0xf0,0x00,0x03,
  1108. 0x08,0x10,0x20,0x00,0x03,0x37,0xef,0xd0,0x00,0x03,0x23,0x45,0x88,0x00,0x03,
  1109. 0x00,0x44,0x00,0x00,0x03,0x3f,0x29,0xf8,0x00,0x03,0x57,0x7d,0xdc,0x00,0x03,
  1110. 0x1f,0x01,0xf8,0x00,0x03,0x74,0xfe,0x54,0x00,0x03,0x4f,0x7f,0x3c,0x00,0x03,
  1111. 0x1d,0x7f,0x70,0x00,0x03,0x6c,0x80,0xb4,0x00,0x03,0x5b,0xff,0x6c,0x00,0x03,
  1112. 0x18,0x00,0x60,0x00,0x03,0x7d,0xff,0xf4,0x00,0x03,0x3f,0x00,0xf8,0x00,0x03,
  1113. 0x12,0x00,0x48,0x00,0x03,0x21,0x00,0x80,0x00,0x03,0x1e,0x00,0x70,0x00,0xfd,
  1114. 0x00,0x03,0x1e,0x00,0x70,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1115. { /* 2 */
  1116. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x3f,0xff,
  1117. 0xf8,0x00,0x03,0x3f,0xff,0xf8,0x00,0xfd,0x00,0x03,0x20,0x00,0x18,0x00,0x03,
  1118. 0x3f,0xff,0xe0,0x00,0xff,0x00,0x01,0x14,0x00,0x03,0x2e,0x01,0x58,0x00,0x03,
  1119. 0x31,0xff,0xe0,0x00,0x03,0x0e,0x01,0xd4,0x00,0x03,0x24,0x01,0x98,0x00,0x03,
  1120. 0x3b,0xff,0xe0,0x00,0x03,0x04,0x01,0xd4,0x00,0x03,0x20,0x01,0x18,0x00,0x03,
  1121. 0x3f,0xff,0xe0,0x00,0x03,0x00,0x01,0xd4,0x00,0x03,0x20,0x6c,0x18,0x00,0x03,
  1122. 0x3f,0x93,0xe0,0x00,0x03,0x00,0x6c,0x14,0x00,0x03,0x20,0x55,0x18,0x00,0x03,
  1123. 0x3f,0xaa,0xe0,0x00,0x03,0x00,0x55,0x14,0x00,0x03,0x20,0x6b,0x18,0x00,0x03,
  1124. 0x3f,0x94,0xe0,0x00,0x03,0x00,0x6b,0x14,0x00,0x03,0x20,0x00,0x18,0x00,0x03,
  1125. 0x3f,0xff,0xe0,0x00,0xff,0x00,0x01,0x14,0x00,0x03,0x3f,0xff,0xf8,0x00,0x00,
  1126. 0x20,0xfe,0x00,0x03,0x1f,0xff,0xf4,0x00,0x03,0x3f,0xff,0xf8,0x00,0xfd,0x00,
  1127. 0xff,0x00,0x01,0x04,0x00,0xfd,0x00,0xfd,0x00,0x03,0x1f,0xff,0xfc,0x00,0xfd,
  1128. 0x00,0xfd,0x00,0xfd,0x00, },
  1129. { /* Folders
  1130. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x03,0xce,0x70,0x00,0x03,0x03,0xce,0x70,
  1131. 0x00,0x03,0x00,0x21,0x08,0x00,0x03,0xfa,0x21,0x00,0x00,0x03,0xfb,0xef,0x70,
  1132. 0x00,0x03,0x00,0x10,0x8c,0x00,0x03,0x86,0xd6,0xb4,0x00,0x03,0xff,0x7b,0xdc,
  1133. 0x00,0x03,0x00,0xc6,0x30,0x00,0x03,0xbb,0xff,0x1c,0x00,0x03,0xcf,0xff,0x34,
  1134. 0x00,0x03,0x38,0x00,0xda,0x00,0x03,0x80,0x00,0x7c,0x00,0xff,0xff,0x01,0x68,
  1135. 0x00,0xff,0x00,0x01,0xba,0x00,0x03,0x80,0x00,0xfc,0x00,0xff,0xff,0x01,0x10,
  1136. 0x00,0xff,0x00,0x01,0xba,0x00,0x03,0x9d,0x54,0xfc,0x00,0x03,0xea,0xab,0x28,
  1137. 0x00,0x03,0x1d,0x54,0xba,0x00,0x03,0x8b,0xac,0xfc,0x00,0x03,0xf5,0x57,0x10,
  1138. 0x00,0x03,0x0b,0xac,0xba,0x00,0x03,0x95,0x54,0xfc,0x00,0x03,0xfa,0xab,0x28,
  1139. 0x00,0x03,0x15,0x54,0xba,0x00,0x03,0x8a,0xac,0xfc,0x00,0x03,0xfd,0x57,0x10,
  1140. 0x00,0x03,0x0a,0xac,0xba,0x00,0x03,0x80,0x00,0xfc,0x00,0xff,0xff,0xff,0x00,
  1141. 0xff,0x00,0x01,0x82,0x00,0xff,0xff,0x01,0xc0,0x00,0x00,0x80,0xfe,0x00,0x03,
  1142. 0x7f,0xff,0xbe,0x00,0xff,0xff,0x01,0xc0,0x00,0xfd,0x00,0xff,0x00,0x01,0x20,
  1143. 0x00,0xfd,0x00,0xfd,0x00,0x03,0x7f,0xff,0xe0,0x00, },
  1144. {  3 */
  1145. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x01,0xff,0x00,0x00,0x03,0x01,0xff,0x00,
  1146. 0x00,0xfd,0x00,0x03,0x0e,0xa0,0xe0,0x00,0x03,0x0e,0x08,0xe0,0x00,0x03,0x01,
  1147. 0xfe,0x00,0x00,0x03,0x12,0x2a,0x18,0x00,0x03,0x10,0x00,0x98,0x00,0x03,0x0a,
  1148. 0x7f,0xe0,0x00,0x03,0x06,0x80,0x10,0x00,0x03,0x00,0x2a,0x00,0x00,0x03,0x1f,
  1149. 0xff,0xe8,0x00,0x03,0x0c,0x28,0x30,0x00,0x03,0x08,0x02,0xa0,0x00,0x03,0x04,
  1150. 0x7f,0xc8,0x00,0x03,0x02,0x80,0x30,0x00,0x03,0x00,0x2a,0x10,0x00,0x03,0x0f,
  1151. 0xff,0xc0,0x00,0x03,0x06,0x20,0x60,0x00,0x03,0x04,0x0a,0xc0,0x00,0x03,0x02,
  1152. 0x7f,0x90,0x00,0x03,0x00,0x80,0x60,0x00,0x03,0x00,0x2a,0x20,0x00,0x03,0x06,
  1153. 0xff,0x80,0x00,0x03,0x02,0x20,0xc0,0x00,0x03,0x02,0x08,0x80,0x00,0x03,0x00,
  1154. 0x7f,0x20,0x00,0xff,0x00,0x01,0xc0,0x00,0x03,0x00,0x2a,0x40,0x00,0x03,0x03,
  1155. 0x7f,0x00,0x00,0xff,0x01,0x01,0x80,0x00,0x03,0x01,0x09,0x00,0x00,0x03,0x00,
  1156. 0x5e,0x40,0x00,0x03,0x00,0xff,0x80,0x00,0x03,0x00,0x80,0x80,0x00,0x00,0x01,
  1157. 0xfe,0x00,0xfd,0x00,0xfd,0x00,0x03,0x00,0xff,0x80,0x00,0xfd,0x00,0xfd,0x00,
  1158. 0xfd,0x00, },
  1159. { /* 4 */
  1160. 0x03,0x00,0xfe,0x00,0x00,0x03,0x00,0x28,0x00,0x00,0xfd,0x00,0x03,0x01,0xff,
  1161. 0x00,0x00,0x03,0x00,0x82,0x00,0x00,0x03,0x02,0x00,0x80,0x00,0x03,0x01,0x93,
  1162. 0x00,0x00,0x03,0x00,0x7c,0x00,0x00,0x03,0x02,0x7c,0x80,0x00,0x03,0x01,0xbb,
  1163. 0x00,0x00,0x03,0x01,0x45,0x00,0x00,0x03,0x02,0xaa,0x80,0x00,0x03,0x19,0x55,
  1164. 0x30,0x00,0x03,0x09,0xab,0x20,0x00,0x03,0x02,0x00,0x88,0x00,0x03,0x1f,0xbb,
  1165. 0xf0,0x00,0x03,0x12,0x44,0x90,0x00,0x03,0x08,0xaa,0x28,0x00,0x03,0x12,0x38,
  1166. 0x90,0x00,0x03,0x0c,0x54,0x60,0x00,0x03,0x03,0xd7,0x88,0x00,0x03,0x38,0x10,
  1167. 0x38,0x00,0x03,0x17,0xef,0xd0,0x00,0x03,0x40,0x10,0x04,0x00,0x03,0x55,0xf7,
  1168. 0x54,0x00,0x03,0x3e,0x08,0xf8,0x00,0x03,0x39,0xf7,0x3a,0x00,0x03,0x55,0x11,
  1169. 0x54,0x00,0x03,0x3e,0xaa,0xf8,0x00,0x03,0x39,0x55,0x3a,0x00,0x03,0x39,0xbb,
  1170. 0x38,0x00,0x03,0x16,0x44,0xd0,0x00,0x03,0x41,0xbb,0x04,0x00,0xff,0x11,0x01,
  1171. 0x30,0x00,0x03,0x0f,0xab,0xc0,0x00,0x03,0x01,0x55,0x28,0x00,0x03,0x0c,0x00,
  1172. 0x60,0x00,0x03,0x03,0xff,0x80,0x00,0x03,0x14,0x00,0x50,0x00,0x03,0x07,0xff,
  1173. 0xc0,0x00,0x00,0x04,0xfe,0x00,0xff,0x00,0x01,0x20,0x00,0xfd,0x00,0xfd,0x00,
  1174. 0x03,0x03,0xff,0xc0,0x00, },
  1175. { /* 5 */
  1176. 0xff,0x00,0x01,0x1a,0x00,0xff,0x00,0x01,0x1e,0x00,0xff,0x00,0x01,0x0c,0x00,
  1177. 0x03,0x00,0x60,0x24,0x00,0x03,0x00,0x60,0x38,0x00,0xff,0x00,0x01,0x08,0x00,
  1178. 0x03,0x00,0x90,0x58,0x00,0x03,0x00,0xf0,0x70,0x00,0xff,0x00,0x01,0x10,0x00,
  1179. 0x03,0x01,0x28,0xb0,0x00,0x03,0x01,0xf8,0xe0,0x00,0x03,0x00,0x20,0x20,0x00,
  1180. 0x03,0x02,0x55,0x60,0x00,0x03,0x03,0xed,0xc0,0x00,0x03,0x00,0x50,0x40,0x00,
  1181. 0x03,0x04,0xaa,0xc0,0x00,0x03,0x07,0xd5,0x80,0x00,0x03,0x00,0xa8,0x80,0x00,
  1182. 0x03,0x09,0x55,0x84,0x00,0x03,0x0f,0xab,0x04,0x00,0x03,0x01,0x51,0x18,0x00,
  1183. 0x03,0x12,0xab,0xa8,0x00,0x03,0x1f,0x5e,0x28,0x00,0x03,0x02,0xa2,0x54,0x00,
  1184. 0x03,0x25,0x5e,0x40,0x00,0x03,0x3e,0xbc,0x00,0x00,0x03,0x05,0x4d,0xb0,0x00,
  1185. 0x03,0x4a,0xbd,0x60,0x00,0x03,0x7d,0x58,0x20,0x00,0x03,0x0a,0xb3,0xc0,0x00,
  1186. 0x03,0x15,0x7b,0x50,0x00,0x03,0x7a,0x88,0xb0,0x00,0x03,0x15,0x67,0x40,0x00,
  1187. 0x03,0x2a,0xaa,0xa8,0x00,0x03,0x75,0x55,0x58,0x00,0x03,0x2a,0xaa,0xa0,0x00,
  1188. 0xff,0x55,0x01,0x54,0x00,0x03,0x6a,0xaa,0xac,0x00,0xff,0x55,0x01,0x50,0x00,
  1189. 0xff,0x55,0x01,0x56,0x00,0xff,0x00,0x01,0x02,0x00,0x03,0x7f,0xff,0xfc,0x00,
  1190. 0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1191. { /* 6 */
  1192. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xff,0x00,0x01,0x20,0x00,0xff,0x00,0x01,0x40,
  1193. 0x00,0xfd,0x00,0x03,0x00,0x80,0x10,0x00,0x03,0x00,0x7f,0xc0,0x00,0x03,0x00,
  1194. 0x80,0x20,0x00,0x03,0x01,0x00,0x08,0x00,0x03,0x00,0xf4,0x00,0x00,0x03,0x01,
  1195. 0x7f,0xf0,0x00,0x03,0x02,0x00,0x18,0x00,0x03,0x01,0xfa,0x10,0x00,0x03,0x02,
  1196. 0xff,0xe4,0x00,0x03,0x00,0x33,0xf0,0x00,0x03,0x03,0xdd,0x20,0x00,0x03,0x01,
  1197. 0xcc,0x4c,0x00,0x03,0x00,0x69,0x20,0x00,0x03,0x03,0xa6,0x40,0x00,0x03,0x01,
  1198. 0x9e,0x98,0x00,0x03,0x08,0x61,0x00,0x00,0x03,0x13,0xee,0x00,0x00,0x03,0x01,
  1199. 0x96,0xf0,0x00,0x03,0x18,0xa1,0x00,0x00,0x03,0x37,0x5c,0x00,0x00,0x03,0x10,
  1200. 0xee,0x80,0x00,0x03,0x3d,0x02,0x00,0x00,0x03,0x62,0xf8,0x00,0x00,0x03,0x3f,
  1201. 0xfd,0x80,0x00,0x03,0x7e,0xce,0x00,0x00,0x03,0x69,0x3a,0x00,0x00,0x03,0x3f,
  1202. 0xf1,0x00,0x00,0x03,0x3f,0xf8,0x00,0x00,0x03,0x30,0x08,0x00,0x00,0x03,0x10,
  1203. 0x06,0x00,0x00,0x00,0x18,0xfe,0x00,0x00,0x10,0xfe,0x00,0x03,0x27,0xf8,0x00,
  1204. 0x00,0xfd,0x00,0xfd,0x00,0x00,0x1c,0xfe,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1205. { /* 7 */
  1206. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x01,0x20,0x24,0x00,0x03,0x00,0x20,0x24,
  1207. 0x00,0x03,0x00,0x10,0x00,0x00,0x03,0x01,0x20,0x24,0x00,0x00,0x01,0xfe,0x00,
  1208. 0x00,0x02,0xfe,0x00,0x03,0x02,0x60,0x4c,0x00,0x03,0x02,0x60,0x4c,0x00,0x03,
  1209. 0x01,0x00,0x20,0x00,0x03,0x02,0x40,0x48,0x00,0xfd,0x00,0xfd,0x00,0x03,0x04,
  1210. 0x80,0x98,0x00,0xff,0x00,0x01,0x90,0x00,0xff,0x00,0x01,0x40,0x00,0x03,0x15,
  1211. 0xa4,0x96,0x00,0x03,0x15,0x84,0x02,0x00,0x03,0x08,0x02,0x08,0x00,0x03,0x1d,
  1212. 0x64,0xa2,0x00,0x03,0x08,0x20,0xa2,0x00,0x03,0x00,0x01,0x10,0x00,0x03,0x1f,
  1213. 0xc9,0x24,0x00,0x03,0x1d,0x41,0x00,0x00,0xff,0x00,0x01,0x8a,0x00,0x03,0x3e,
  1214. 0x5d,0xc8,0x00,0x03,0x2a,0x08,0x80,0x00,0x03,0x00,0x22,0x14,0x00,0x03,0x6c,
  1215. 0x76,0x8e,0x00,0x03,0x44,0x54,0x0c,0x00,0x03,0x02,0x08,0x40,0x00,0x00,0x4c,
  1216. 0xfe,0x00,0x00,0x08,0xfe,0x00,0xfd,0x00,0x00,0xd8,0xfe,0x00,0x00,0xd0,0xfe,
  1217. 0x00,0x00,0x04,0xfe,0x00,0x00,0xa8,0xfe,0x00,0x00,0x88,0xfe,0x00,0x00,0x40,
  1218. 0xfe,0x00,0x00,0xc0,0xfe,0x00,0x00,0x40,0xfe,0x00,0xfd,0x00, },
  1219. { /* 8 */
  1220. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x00,0x78,0xfe,0x00,0x00,0x48,0xfe,0x00,0x00,
  1221. 0x04,0xfe,0x00,0x00,0x8e,0xfe,0x00,0x00,0xb0,0xfe,0x00,0x00,0x49,0xfe,0x00,
  1222. 0x03,0x83,0xe0,0x00,0x00,0x03,0x7d,0x60,0x00,0x00,0x03,0x02,0x10,0x00,0x00,
  1223. 0x03,0xbb,0xfc,0x00,0x00,0x03,0x7e,0xec,0x00,0x00,0x03,0x3f,0x62,0x00,0x00,
  1224. 0x03,0xc1,0xfb,0x78,0x00,0x03,0x3f,0xc2,0x48,0x00,0x03,0x40,0xdc,0x80,0x00,
  1225. 0x03,0xff,0xf0,0x4c,0x00,0x03,0x81,0xdf,0x0c,0x00,0x03,0x00,0xb0,0xb0,0x00,
  1226. 0x03,0x03,0xd9,0xbc,0x00,0x03,0x02,0xbe,0x10,0x00,0x03,0x7c,0x19,0x78,0x00,
  1227. 0x03,0x03,0xe5,0xa4,0x00,0x03,0x02,0x5e,0x08,0x00,0x03,0x01,0x06,0xd0,0x00,
  1228. 0x03,0x07,0x9b,0xd4,0x00,0x03,0x07,0x06,0x28,0x00,0x03,0x03,0x6a,0x82,0x00,
  1229. 0x03,0x3e,0x8d,0xec,0x00,0x03,0x26,0x02,0x90,0x00,0x03,0x07,0x74,0x4a,0x00,
  1230. 0x03,0x05,0x04,0xfc,0x00,0x03,0x04,0x02,0x04,0x00,0x03,0x0a,0xe9,0x72,0x00,
  1231. 0x03,0x0e,0x03,0xf8,0x00,0x03,0x08,0x03,0x48,0x00,0x03,0x01,0x85,0x06,0x00,
  1232. 0xfd,0x00,0xfd,0x00,0x03,0x00,0x03,0xfc,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1233. { /* 9 */
  1234. 0x03,0x00,0x7c,0x00,0x00,0x03,0x00,0x7c,0x00,0x00,0x03,0x00,0x82,0x00,0x00,
  1235. 0xff,0x01,0xff,0x00,0x03,0x01,0xf9,0x00,0x00,0xfd,0x00,0x03,0x00,0x79,0x00,
  1236. 0x00,0x03,0x01,0xbc,0x00,0x00,0x00,0x02,0xfe,0x00,0x03,0x02,0x85,0x00,0x00,
  1237. 0x03,0x03,0x06,0x00,0x00,0x03,0x00,0x40,0x80,0x00,0x03,0x02,0x85,0x00,0x00,
  1238. 0x03,0x03,0x06,0x00,0x00,0xff,0x00,0x01,0x80,0x00,0x03,0x00,0x85,0x00,0x00,
  1239. 0x03,0x01,0x06,0x00,0x00,0x03,0x02,0x00,0x80,0x00,0x03,0x05,0xbb,0x80,0x00,
  1240. 0x03,0x07,0x2a,0x00,0x00,0x03,0x05,0xbb,0xc0,0x00,0x03,0x03,0x00,0x40,0x00,
  1241. 0x03,0x06,0x7e,0x00,0x00,0x03,0x0b,0x7e,0xa0,0x00,0x03,0x02,0x10,0x40,0x00,
  1242. 0x03,0x04,0xd6,0x00,0x00,0x03,0x0a,0xef,0xa0,0x00,0x03,0x07,0x38,0x40,0x00,
  1243. 0x03,0x04,0x6e,0x00,0x00,0x03,0x0f,0x46,0xa0,0x00,0x03,0x06,0x10,0x40,0x00,
  1244. 0x03,0x04,0xc6,0x00,0x00,0x03,0x0e,0xef,0xa0,0x00,0x03,0x07,0x38,0x40,0x00,
  1245. 0x03,0x04,0x6e,0x00,0x00,0x03,0x0f,0x46,0xa0,0x00,0x03,0x06,0x00,0x40,0x00,
  1246. 0x03,0x04,0xfe,0x00,0x00,0x03,0x0e,0xff,0xa0,0x00,0x03,0x03,0xff,0xc0,0x00,
  1247. 0xff,0x00,0x01,0x40,0x00,0x03,0x04,0x00,0x20,0x00,0xfd,0x00,0xfd,0x00,0x03,
  1248. 0x03,0xff,0xc0,0x00, },
  1249. { /* 10 */
  1250. 0x03,0x00,0x04,0x00,0x00,0x03,0x00,0x04,0x00,0x00,0x03,0x00,0xfb,0x00,0x00,
  1251. 0x03,0x00,0xf9,0x00,0x00,0x03,0x00,0x01,0x00,0x00,0x03,0x03,0xfa,0x80,0x00,
  1252. 0x03,0x01,0x1c,0x80,0x00,0x03,0x00,0xf8,0x80,0x00,0x03,0x03,0x1d,0x40,0x00,
  1253. 0x03,0x02,0x7e,0xc0,0x00,0x03,0x01,0xc0,0xc0,0x00,0x03,0x06,0x7e,0x20,0x00,
  1254. 0x03,0x02,0xfe,0x40,0x00,0x03,0x01,0x80,0x00,0x00,0x03,0x06,0xfe,0xa0,0x00,
  1255. 0x03,0x02,0xc2,0x40,0x00,0x00,0x01,0xfe,0x00,0x03,0x06,0xe6,0xa0,0x00,0x03,
  1256. 0x03,0xe6,0x40,0x00,0x03,0x01,0x24,0x00,0x00,0x03,0x07,0xf7,0xa0,0x00,0x03,
  1257. 0x03,0xf5,0xc0,0x00,0x03,0x02,0x91,0x40,0x00,0x03,0x01,0xe4,0x20,0x00,0x03,
  1258. 0x01,0x61,0x80,0x00,0x03,0x01,0x00,0x80,0x00,0x03,0x00,0x6e,0x40,0x00,0x03,
  1259. 0x00,0xdf,0x00,0x00,0x03,0x00,0xe5,0x00,0x00,0x03,0x00,0x50,0x80,0x00,0x03,
  1260. 0x00,0xf7,0x00,0x00,0x03,0x00,0xcd,0x00,0x00,0x03,0x00,0x14,0x80,0x00,0x03,
  1261. 0x00,0xdf,0x00,0x00,0x03,0x00,0xe5,0x00,0x00,0x03,0x00,0x50,0x80,0x00,0x03,
  1262. 0x00,0x5b,0x00,0x00,0x03,0x00,0x49,0x00,0x00,0x03,0x00,0xbc,0x80,0x00,0x03,
  1263. 0x00,0x7e,0x00,0x00,0x03,0x00,0x62,0x00,0x00,0x03,0x00,0x01,0x00,0x00,0xfd,
  1264. 0x00,0xfd,0x00,0xfd,0x00, },
  1265. { /* 11 */
  1266. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x00,0xfe,0x00,0x00,0x03,0x00,0xfe,0x00,
  1267. 0x00,0x03,0x00,0xfe,0x00,0x00,0x03,0x03,0xeb,0x80,0x00,0x03,0x03,0xeb,0x80,
  1268. 0x00,0x03,0x03,0xeb,0x80,0x00,0x03,0x04,0xfe,0x40,0x00,0x03,0x04,0x82,0x40,
  1269. 0x00,0x03,0x05,0x00,0x40,0x00,0x03,0x0b,0x9f,0xe0,0x00,0x03,0x0a,0xb3,0x60,
  1270. 0x00,0x03,0x0c,0x00,0x20,0x00,0x03,0x1a,0xdc,0xe0,0x00,0x03,0x18,0x78,0xd0,
  1271. 0x00,0x03,0x15,0x01,0x18,0x00,0x03,0x32,0xf4,0xd8,0x00,0x03,0x32,0x10,0xd8,
  1272. 0x00,0x03,0x21,0x0b,0x44,0x00,0x03,0x62,0xf8,0x08,0x00,0x03,0x6e,0x80,0x64,
  1273. 0x00,0x03,0x41,0x05,0x04,0x00,0x03,0xc1,0x00,0x30,0x00,0x03,0xdd,0x22,0xe0,
  1274. 0x00,0x03,0xa0,0xf7,0x28,0x00,0x03,0x90,0x80,0x60,0x00,0x03,0x9e,0x85,0xc0,
  1275. 0x00,0x03,0x90,0x56,0x50,0x00,0x03,0x3c,0x61,0x40,0x00,0x03,0xbf,0x63,0x00,
  1276. 0x00,0x03,0xc4,0x19,0xa0,0x00,0x03,0x0f,0xa9,0x80,0x00,0x03,0x0b,0xfd,0x00,
  1277. 0x00,0x03,0x31,0xa8,0x40,0x00,0x03,0x03,0xff,0x00,0x00,0x03,0x02,0x01,0x00,
  1278. 0x00,0x03,0x0c,0x00,0x80,0x00,0x03,0x00,0x7c,0x00,0x00,0x03,0x00,0x7c,0x00,
  1279. 0x00,0x03,0x03,0x82,0x00,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1280. { /* 12 */
  1281. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x07,0xff,0xc0,0x00,0x03,0x07,0xff,0xc0,
  1282. 0x00,0x03,0x08,0x00,0x20,0x00,0x03,0x0a,0x00,0x20,0x00,0x03,0x0d,0xff,0x80,
  1283. 0x00,0x00,0x02,0xfe,0x00,0x03,0x0e,0x00,0x20,0x00,0x03,0x0a,0x00,0x40,0x00,
  1284. 0x03,0x05,0xff,0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0xff,0x40,0x00,
  1285. 0xff,0x00,0x01,0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0xff,0x40,0x00,
  1286. 0xff,0x00,0x01,0x80,0x00,0x03,0x0b,0xff,0xa0,0x00,0x03,0x0b,0x03,0xc0,0x00,
  1287. 0xfd,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0a,0x79,0x40,0x00,0x03,0x04,0x00,
  1288. 0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0x87,0x40,0x00,0xff,0x00,0x01,
  1289. 0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0x33,0x40,0x00,0x03,0x04,0x00,
  1290. 0x80,0x00,0x03,0x0b,0xff,0xa0,0x00,0x03,0x0b,0x33,0xc0,0x00,0x00,0x04,0xfe,
  1291. 0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0x03,0x40,0x00,0x03,0x04,0x00,0x80,
  1292. 0x00,0x03,0x0b,0xff,0xa0,0x00,0x03,0x0b,0xff,0xc0,0x00,0x00,0x04,0xfe,0x00,
  1293. 0x03,0x0f,0xff,0xa0,0x00,0x03,0x0f,0xff,0xc0,0x00,0xfd,0x00,0x03,0x0f,0xff,
  1294. 0xc0,0x00,0x00,0x08,0xfe,0x00,0xfd,0x00, },
  1295. { /* 13 */
  1296. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x60,0x18,0x0c,0x00,0x03,0x00,0x38,0x00,
  1297. 0x00,0x03,0x60,0x18,0x0c,0x00,0x03,0x20,0x28,0x04,0x00,0x03,0x60,0x18,0x0c,
  1298. 0x00,0xff,0x20,0x01,0x06,0x00,0x03,0xf0,0x38,0x14,0x00,0x03,0x42,0x08,0x84,
  1299. 0x00,0x03,0xe0,0x20,0x0a,0x00,0x03,0x59,0x0d,0xec,0x00,0x03,0x30,0x1c,0x1c,
  1300. 0x00,0x03,0x40,0x00,0x82,0x00,0x03,0x1c,0xb6,0x4c,0x00,0x03,0x2a,0x15,0x24,
  1301. 0x00,0x03,0x11,0x38,0x82,0x00,0x03,0x26,0x4c,0xdc,0x00,0x03,0x35,0x2a,0x54,
  1302. 0x00,0x03,0x28,0x91,0x40,0x00,0x03,0x2b,0x3d,0x98,0x00,0x03,0x12,0x3d,0x90,
  1303. 0x00,0x03,0x28,0xa2,0xa4,0x00,0x03,0x15,0xb7,0x38,0x00,0x03,0x1f,0xd2,0x68,
  1304. 0x00,0x03,0x10,0x35,0x04,0x00,0x03,0x12,0x6c,0xf8,0x00,0x03,0x0a,0xba,0x68,
  1305. 0x00,0x03,0x12,0x64,0xc4,0x00,0x03,0x06,0x9c,0xb0,0x00,0x03,0x09,0x79,0x20,
  1306. 0x00,0x03,0x06,0x98,0x88,0x00,0x03,0x09,0x89,0x70,0x00,0x03,0x0d,0x91,0x50,
  1307. 0x00,0x03,0x08,0x02,0x88,0x00,0x03,0x0a,0xba,0xf0,0x00,0x03,0x05,0x4d,0x10,
  1308. 0x00,0x03,0x08,0x10,0x40,0x00,0x03,0x03,0x9e,0xe0,0x00,0x03,0x06,0x1c,0x00,
  1309. 0x00,0x03,0x03,0xe1,0x10,0x00,0x03,0x03,0xff,0xe0,0x00,0x03,0x03,0xff,0xe0,
  1310. 0x00,0xff,0x00,0x01,0x10,0x00, },
  1311. { /* 14 */
  1312. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x00,0x60,0xfe,0x00,0x00,0x20,0xfe,0x00,0x00,
  1313. 0x10,0xfe,0x00,0x00,0x98,0xfe,0x00,0x00,0xf8,0xfe,0x00,0x00,0x04,0xfe,0x00,
  1314. 0x00,0x6f,0xfe,0x00,0x00,0x51,0xfe,0x00,0x03,0x20,0x80,0x00,0x00,0x03,0x3f,
  1315. 0xc0,0x00,0x00,0x03,0x24,0x40,0x00,0x00,0x03,0x00,0x20,0x00,0x00,0x03,0x0f,
  1316. 0xf8,0x00,0x00,0x03,0x01,0x18,0x00,0x00,0xfd,0x00,0x03,0x07,0x7e,0x00,0x00,
  1317. 0x03,0x04,0x06,0x00,0x00,0x03,0x00,0x80,0x00,0x00,0x03,0x01,0xdf,0x80,0x00,
  1318. 0x03,0x01,0x40,0x80,0x00,0x03,0x02,0x20,0x00,0x00,0x03,0x00,0x67,0x60,0x00,
  1319. 0x03,0x00,0x05,0x20,0x00,0x03,0x00,0x98,0x90,0x00,0x03,0x00,0x3e,0xd8,0x00,
  1320. 0x03,0x00,0x2b,0x40,0x00,0x03,0x00,0x04,0xe0,0x00,0x03,0x00,0x0c,0x4c,0x00,
  1321. 0x03,0x00,0x09,0x90,0x00,0x03,0x00,0x12,0x68,0x00,0x03,0x00,0x06,0x04,0x00,
  1322. 0x03,0x00,0x06,0xb8,0x00,0x03,0x00,0x01,0x42,0x00,0x03,0x00,0x01,0xc4,0x00,
  1323. 0x03,0x00,0x01,0x70,0x00,0x03,0x00,0x02,0x0a,0x00,0xff,0x00,0x01,0x78,0x00,
  1324. 0xff,0x00,0x01,0x60,0x00,0xff,0x00,0x01,0x86,0x00,0xfd,0x00,0xfd,0x00,0xff,
  1325. 0x00,0x01,0x3e,0x00, },
  1326. };
  1327. ///
  1328. /// CO_New
  1329. //  Creates configuration window
  1330. enum { CMEN_OPEN = 1201, CMEN_SAVEAS, CMEN_DEF, CMEN_DEFALL, CMEN_LAST, CMEN_REST, CMEN_MIME };
  1331.  
  1332. LOCAL struct CO_ClassData *CO_New(void)
  1333. {
  1334.    struct CO_ClassData *data;
  1335.  
  1336.    if (data = calloc(1,sizeof(struct CO_ClassData)))
  1337.    {
  1338.       static struct PageList page[MAXCPAGES], *pages[MAXCPAGES+1];
  1339.       APTR lv;
  1340.       int i;
  1341.       for (i = 0; i < MAXCPAGES; i++) { page[i].Offset = i; pages[i] = &page[i]; }
  1342.       pages[i] = NULL;
  1343.       page[ 0].PageLabel = MSG_CO_CrdFirstSteps;
  1344.       page[ 1].PageLabel = MSG_CO_CrdTCPIP;
  1345.       page[ 2].PageLabel = MSG_CO_CrdNewMail;
  1346.       page[ 3].PageLabel = MSG_CO_CrdFilters;
  1347.       page[ 4].PageLabel = MSG_CO_CrdRead;
  1348.       page[ 5].PageLabel = MSG_CO_CrdWrite;
  1349.       page[ 6].PageLabel = MSG_CO_CrdReply;
  1350.       page[ 7].PageLabel = MSG_CO_CrdSignature;
  1351.       page[ 8].PageLabel = MSG_CO_CrdLists;
  1352.       page[ 9].PageLabel = MSG_CO_CrdSecurity;
  1353.       page[10].PageLabel = MSG_CO_CrdStartQuit;
  1354.       page[11].PageLabel = MSG_CO_CrdMIME;
  1355.       page[12].PageLabel = MSG_CO_CrdABook;
  1356.       page[13].PageLabel = MSG_CO_CrdScripts;
  1357.       page[14].PageLabel = MSG_CO_CrdMixed;
  1358.       data->GUI.WI = WindowObject,
  1359.          MUIA_Window_Title, GetStr(MSG_MA_MConfig),
  1360.          MUIA_HelpNode,"CO_W",
  1361.          MUIA_Window_Menustrip, MenustripObject,
  1362.             MUIA_Family_Child, MenuObject, MUIA_Menu_Title, GetStr(MSG_MA_Project),
  1363.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_Open), MUIA_Menuitem_Shortcut,"O", MUIA_UserData,CMEN_OPEN, End,
  1364.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_SaveAs), MUIA_Menuitem_Shortcut,"A", MUIA_UserData,CMEN_SAVEAS, End,
  1365.             End,
  1366.             MUIA_Family_Child, MenuObject, MUIA_Menu_Title, GetStr(MSG_CO_Edit),
  1367.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_ResetDefaults), MUIA_Menuitem_Shortcut,"D", MUIA_UserData,CMEN_DEF, End,
  1368.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_ResetAll), MUIA_Menuitem_Shortcut,"E", MUIA_UserData,CMEN_DEFALL, End,
  1369.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_LastSaved), MUIA_Menuitem_Shortcut,"L", MUIA_UserData,CMEN_LAST, End,
  1370.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_Restore), MUIA_Menuitem_Shortcut,"R", MUIA_UserData,CMEN_REST, End,
  1371.             End,
  1372.             MUIA_Family_Child, MenuObject, MUIA_Menu_Title, GetStr(MSG_CO_Extras),
  1373.                MUIA_Family_Child, data->GUI.MI_IMPMIME = MenuitemObject, MUIA_Menuitem_Enabled,FALSE, MUIA_Menuitem_Title,GetStr(MSG_CO_ImportMIME), MUIA_UserData,CMEN_MIME, End,
  1374.             End,
  1375.          End,
  1376.          MUIA_Window_ID, MAKE_ID('C','O','N','F'),
  1377.          WindowContents, VGroup,
  1378.             Child, HGroup,
  1379.                Child, lv = ListviewObject,
  1380.                   MUIA_CycleChain,1,
  1381.                   MUIA_Listview_List, data->GUI.LV_PAGE = NewObject(CL_PageList->mcc_Class,NULL,
  1382.                      InputListFrame,
  1383.                      MUIA_List_AdjustWidth, TRUE,
  1384.                      MUIA_List_MinLineHeight, 16,
  1385.                      MUIA_List_SourceArray, pages,
  1386.                      MUIA_List_Active, 0,
  1387.                   End,
  1388.                End,
  1389.                Child, data->GUI.GR_PAGE = VGroup,
  1390.                   TextFrame,
  1391.                   InnerSpacing(6,6),
  1392.                   MUIA_Background, MUII_PageBack,
  1393.                   Child, data->GUI.GR_SUBPAGE = CO_BuildPage(data, 0),
  1394.                End,
  1395.             End,
  1396.             Child, HGroup,
  1397.                MUIA_Group_SameWidth, TRUE,
  1398.                Child, data->GUI.BT_SAVE   = MakeButton(GetStr(MSG_CO_Save)),
  1399.                Child, data->GUI.BT_USE    = MakeButton(GetStr(MSG_CO_Use)),
  1400.                Child, data->GUI.BT_CANCEL = MakeButton(GetStr(MSG_CO_Cancel)),
  1401.             End,
  1402.          End,
  1403.       End;
  1404.       if (data->GUI.WI)
  1405.       {
  1406.          DoMethod(G->App, OM_ADDMEMBER, data->GUI.WI);
  1407.          set(data->GUI.WI, MUIA_Window_DefaultObject, lv);
  1408.          SetHelp(data->GUI.BT_SAVE,   MSG_HELP_CO_BT_SAVE);
  1409.          SetHelp(data->GUI.BT_USE,    MSG_HELP_CO_BT_USE);
  1410.          SetHelp(data->GUI.BT_CANCEL, MSG_HELP_CO_BT_CANCEL);
  1411.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_OPEN     ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_OpenConfigHook);
  1412.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_SAVEAS   ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_SaveConfigAsHook);
  1413.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_DEF      ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ResetToDefaultHook,FALSE);
  1414.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_DEFALL   ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ResetToDefaultHook,TRUE);
  1415.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_LAST     ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_LastSavedHook);
  1416.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_REST     ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_RestoreHook);
  1417.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_MIME     ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ImportCTypesHook,FALSE);
  1418.          DoMethod(data->GUI.LV_PAGE     ,MUIM_Notify,MUIA_List_Active        ,MUIV_EveryTime,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ChangePageHook,MUIV_TriggerValue);
  1419.          DoMethod(data->GUI.BT_SAVE     ,MUIM_Notify,MUIA_Pressed            ,FALSE         ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,2);
  1420.          DoMethod(data->GUI.BT_USE      ,MUIM_Notify,MUIA_Pressed            ,FALSE         ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,1);
  1421.          DoMethod(data->GUI.BT_CANCEL   ,MUIM_Notify,MUIA_Pressed            ,FALSE         ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,0);
  1422.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE          ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,0);
  1423.          return data;
  1424.       }
  1425.       free(data);
  1426.    }
  1427.    return NULL;
  1428. }  
  1429. ////
  1430.